#ifndef V_SOCKET_H
#define V_SOCKET_H

#include <Winsock2.h>

class VAddress;

// this is a simple tcp socket

class VSocket {
private:
	SOCKET m_socket;
public:
	VSocket();
	~VSocket();
	int create();
	void bind(const char* address, unsigned short port) const;
	void connect(const char* address, unsigned short port) const;
	void bind(unsigned short port) const;
	void listen(int backlog = 3) const;
	void accept(VSocket* pSocket, VAddress* pAddress = NULL) const;
	void close();
	int send(const char* buf, int len) const;
	void sendAll(const char* buf, int len = 0) const;
	int recv(char* buf, int len) const;
	void recvAll(char* buf, int len) const;
	int recv() const;

};

#endif